<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script type="text/javascript">
        window.onload = function () {
            var btn = document.getElementById("btnId");
            btn.onclick = function () {
                //console.log()可以将内容以日志的方式输出到浏览器的控制台
                var testId = document.getElementById("testId");
                //console.log(testId.type);
                //testId.type = "button";
                var testNames = document.getElementsByName("testName");
                /*for (var i = 0; i < testNames.length; i++) {
                    testNames[i].type = "checkbox";
                }*/
                var inputs = document.getElementsByTagName("input");
                for (var i = 0; i < inputs.length; i++) {
                    alert(inputs[i].value);
                }
            };
        };
    </script>

</head>
<body>
<input type="text" id="testId">
<input type="text" name="testName">
<input type="text" name="testName">
<input type="text">
<input type="button" value="点击" id="btnId">
</body>
</html>